package com.sven.idrivingfutureserver.common;

import lombok.ToString;


@ToString
public enum CommonCode implements ResultCode {

    SUCCESS(true, 1000, "操作成功！"),
    FAIL(false, 1001, "操作失败"),
    INVALID_PARAM(false, 1002, "参数错误"),
    PARAM_MISSING_ERROR(false, 1003, "参数缺失"),
    NO_PERMISSION(false, 1004, "没有权限"),
    SERVER_ERROR(false, 9999, "抱歉，系统繁忙，请稍后重试！"),

    // 登录模块(10000 ~ 10999)
    WX_LOGIN_ERROR(false, 10001, "微信登录失败"),
    MOBILE_ERROR(false, 10002, "手机号格式错误"),
    GET_PHONE_NUMBER_ERROR(false, 10003, "获取用户手机号失败"),
    BINDING_ERROR(false, 10005, "参数绑定异常"),
    CHANGE_PHONE_NUMBER_FAILED(false, 10006, "修改手机号码失败"),


    // Sa-Token相关(11000 ~ 11999)
    NOT_LOGIN_ERROR(false, 11001, "请先登录系统"),
    NOT_PERMISSION_ERROR(false, 11002, "没有权限"),
    FORCE_LOGOUT_ERROR(false, 11003, "已被顶下线"),
    KICK_OUT_ERROR(false, 11004, "已被踢下线"),

    // 挪车码相关(12000 ~ 12999)
    QRCODE_NOT_EXIST(false, 12000, "挪车码无效"),
    QRCODE_GEN_NUM_ERROR(false, 12001, "生成挪车码数量错误"),
    QRCODE_ALREADY_BINGING(false, 12002, "该挪车码已绑定车主"),
    QRCODE_ALREADY_BINGING_BY_OTHERS(false, 12003, "该挪车码已被其他车主绑定"),
    QRCODE_NOT_BINDING(false, 12004, "该挪车码尚未绑定车辆信息"),
    PHONE_NUMBER_NOT_EXIST(false, 12005, "未查询到手机号码"),
    SEND_SMS_TOO_FAST(false, 12006, "每5分钟只能发送一次短信"),
    MAKE_PHONE_CALL_TOO_FAST(false, 12007, "每5分钟只能打一次电话"),
    SEND_SMS_NOT_ALLOWED(false, 12008, "车主拒收短信"),
    PLATE_NUMBER_NOT_EXIST(false, 12009, "车牌号不存在"),
    USER_SETTING_NOT_EXIST(false, 12010, "用户设置信息不存在"),
    USER_NOT_EXIST(false, 12011, "用户不存在"),
    ;

    final boolean success;

    final int code;

    String message;

    CommonCode(boolean success, int code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }

    @Override
    public boolean success() {
        return success;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String message() {
        return message;
    }

    public void setMessage(String msg) {
        this.message = msg;
    }
}
